package com.moyu.admin.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.moyu.admin.entity.SysRole;
import com.moyu.admin.mapper.SysRoleMapper;
import com.moyu.admin.service.SysRoleService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author moyu
 * @since 2019-02-18
 */
@Service
@Transactional
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {

  @Autowired
  private SysRoleMapper sysRoleMapper;

  @Override
  public List<SysRole> findRolesByUser(Long userId) {
    return sysRoleMapper.findRolesByUser(userId);
  }

  @Override
  public Page<SysRole> selectRolePage(Page<SysRole> page) {
    page.setRecords(sysRoleMapper.selectRoleList(page));
    return page;
  }
}
